<template>
	<view class="content">
		<view class="item-content">
			
			<view class="form-content">
				
				<uni-forms ref="form" :modelValue="formData" :rules="rules" label-position="left" label-width="150rpx">
					<ApplyInfo v-if="formData && formData.id > 0" :apply-id="formData.id"></ApplyInfo>
					<uni-row>
						<uni-col :span="24">
							<uni-forms-item label="合计分数">
								<view style="font-size: 32rpx;font-weight: bolder;color: #ff0000;">{{formData.score +'分'}}</view>
							</uni-forms-item>
						</uni-col>
						<uni-col :span="24">
							<uni-forms-item label="审核" name="pass" required>
								<uni-data-checkbox mode="button" v-model="formData.pass" :localdata="dicts['pass']"/>
							</uni-forms-item>
						</uni-col>
						<uni-col :span="24">
							<uni-forms-item label="备注" name="notes">
								<uni-easyinput type="textarea" v-model="form.notes"></uni-easyinput >
							</uni-forms-item>
						</uni-col>
						
					</uni-row>
					
					<uni-forms-item label-width="0rpx">
						<button @click="submit">提 交</button>
					</uni-forms-item>
					<view style="height: 60rpx;"></view>
				</uni-forms>
					
				
				
			</view>
			
		</view>
		
		
		
		
		
		
		
		
		
		
	</view>
</template>

<script>
	import ApplyInfo from "@/pages/apply/applyInfo/applyInfo/applyInfo";
	import { getDicts } from '@/components/DictTag/DictTag.js'
	export default {
		components: {
			ApplyInfo
		},
		data() {
			return {
				dictTypes:[
					'pass'
				],
				dicts:{
					pass:[],
				},
				status: 200,
				formData:{
					id:null,
					score:0,
					pass :null
				},
				rules:{
					pass: {
						rules:[{ required: true, errorMessage: "请选择审核结果"}],
					}
				},
			}
		},
		onLoad(option) {
			this.formData.id = option.id
			this.formData.score = option.score
			this.status = option.status
			this.getFormatDicts()
		},
		methods: {
			getFormatDicts(){
				this.dictTypes.forEach(dictType =>{
					getDicts(dictType).then(res =>{
						this.dicts[dictType] = res
					})
				})
			},
			submit() {
				uni.showLoading()
				let url = '/points/poiApplyExamine/poiApplyExamine'
				if(this.status == 300){
					url = '/points/poiApplyReexamine/poiApplyReexamine'
				}
				this.$refs.form.validate().then(valid => {
					if(valid){
						this.$http({
							url: url,
							method: 'post',
							data: this.formData
						}).then(res => {
							uni.reLaunch({
								url:'/pages/index/index'
							})
							uni.hideLoading()
						})
					}
				}).catch(err => {
					uni.hideLoading()
				})
			}
		}
		
		
	}
</script>

<style lang="scss">


.title-item{
	height: 100rpx;
	padding-top: 25rpx;
	.font-bolder {
		font-weight: bolder;
		color: #1890ff;
		border-left: solid #1890ff 10rpx;
		padding-left: 3%;
		height: 50rpx;
		line-height: 50rpx;
	}
}

.item-content{
	background-color: white;
	width: 100%;
	padding-top: 50rpx;
	
}
.form-content{
	width: 96%;
	margin-left: 2%;
}
button {
	height: 80rpx;
	line-height: 80rpx;
	background-color: #1296db;
	color: white;
}
	
</style>
